home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Science / µSim 1.0b5 folder / source / SimAsm.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-09  |  2.5 KB  |  128 lines  |  [TEXT/MMCC]

  1. #include    "ControlStore.h"
  2. #include    "Globals.h"
  3. #include    "Microprogram_Ed.h"
  4. #include    "SimAsm.h"
  5.  
  6.  
  7. Boolean instrClikLoop(void)
  8. {
  9. Rect tempRect = *keyrects[kKEY_LIST];
  10. Point    tempPt;
  11.  
  12. tempRect.right -= kScrollbarAdjust;
  13. GetMouse(&tempPt);
  14. draggedOnComments = PtInRect(tempPt, &tempRect);
  15.  
  16. #if USESROUTINEDESCRIPTORS
  17. return draggedOnComments;
  18. #else
  19. return draggedOnComments == false;
  20. #endif
  21. }
  22.  
  23. Boolean commentClikLoop(void)
  24. {
  25. union u_mir tmpmir;
  26. Rect    clkRect, destRect;
  27. Point    curPt;
  28. register short    cellMid, temp;
  29.  
  30. curPt = LLastClick(Lists[kL_COMMENTS]);
  31. tmpmir = *(gCsMemory + curPt.v);
  32. if (tmpmir.bits.cond) {
  33.     LRect(&clkRect, curPt, Lists[kL_COMMENTS]);
  34.     GetMouse(&curPt);
  35.     if (PtInRect(curPt, &clkRect)) {
  36.         if (arrowDrawn == false) {
  37.             cellMid = (clkRect.top + clkRect.bottom) >> 1;
  38.             temp = clkRect.left - klateralCellTweek;
  39.             MoveTo(temp, cellMid);
  40.             temp -= karrowDistFromList;
  41.             LineTo(temp, cellMid);
  42.             curPt.h = 0;
  43.             curPt.v = tmpmir.bits.addr;
  44.             LRect(&destRect, curPt, Lists[kL_COMMENTS]);
  45.             cellMid = (destRect.top + destRect.bottom) >> 1;
  46.             LineTo(temp, cellMid);
  47.             temp += karrowDistFromList;
  48.             LineTo(temp, cellMid);
  49.             LineTo(temp, cellMid);
  50.             LineTo(temp - karrowHead, cellMid - karrowHead);
  51.             MoveTo(temp, cellMid);
  52.             LineTo(temp - karrowHead, cellMid + karrowHead);
  53.             arrowDrawn = true;
  54.             }
  55.         }
  56.     else if (arrowDrawn) {
  57.         EraseArrowRect();
  58. //        UnloadSeg(EraseArrowRect);
  59.         }
  60.     }
  61. return kListClickLoopTrue;
  62. }
  63.  
  64. #if defined(powerc) || defined (__powerc)
  65.  
  66. Boolean switchCursClikLoop(void)
  67. {
  68. Rect tempRect = *keyrects[kKEY_LIST];
  69. Point    tempPt;
  70. Boolean d7;
  71.  
  72. tempRect.right -= kScrollbarAdjust;
  73. GetMouse(&tempPt);
  74. d7 = PtInRect(tempPt, &tempRect);
  75. if (d7 != draggedOnComments) {
  76.     SetCursor(d7 ? *GetCursor(kSheetsCursor) : &qd.arrow);
  77.     draggedOnComments = d7;
  78.     }
  79.  
  80. return kListClickLoopTrue;
  81. }
  82.  
  83. #else
  84.  
  85. asm Boolean switchCursClikLoop(void)
  86. {
  87.     LINK    A6,#-8
  88.     MOVEA.L    keyrects+(kKEY_LIST*4),A0
  89.     LEA        -8(A6),A1
  90.     MOVE.L    (A0)+,(A1)+
  91.     MOVE.L    (A0),(A1)+
  92.     SUBI.W    #kScrollbarAdjust,-(A1)
  93.  
  94.     MOVE.L    D7,-(SP)
  95.     SUBQ.L    #2,SP
  96.     MOVE.L    D5,-(SP)    //we must not overwrite D5 (contains mouse location)
  97.     PEA        -8(A6)
  98.     _PtInRect
  99.     MOVE.B    (SP)+,D7
  100.     CMP.B    draggedOnComments,D7
  101.     BEQ.S    exitasm
  102.     
  103.     TST.B    D7
  104.     BEQ.S    restoreplus
  105.     
  106.     SUBQ.L    #4,SP
  107.     MOVE.W    #kSheetsCursor,-(SP)
  108.     _GetCursor
  109.     MOVEA.L    (SP),A0
  110.     MOVE.L    (A0),(SP)
  111.     _SetCursor
  112.     BRA.S    goodexit
  113. restoreplus:
  114.     PEA        qd.arrow
  115.     _SetCursor
  116. goodexit:
  117.     MOVE.B    D7,draggedOnComments
  118. exitasm:
  119.     MOVE.L    (SP)+,D7
  120.     MOVEQ    #1,D0
  121. //    MOVE.B    D0,8(A6)    //    true    (actually is not needed)!
  122.     
  123.     UNLK    A6
  124.     RTS
  125. }
  126.  
  127. #endif
  128.